local joy__xinglunan = fk.CreateSkill {

  name = "joy__xinglunan",

  tags = { Skill.Compulsory, },

}



joy__xinglunan:addEffect(fk.CardUseFinished, {
  name = "joy__xinglunan",
  events = {fk.CardUseFinished},
  anim_type = "defensive",
  frequency = Skill.Compulsory,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(joy__xinglunan.name) and target ~= player and data.card.trueName == "slash" and player ~= player.room.current
    and table.contains(data:getAllTargets(), player.id)
  end,
  on_use = function(self, event, target, player, data)
    player.room:addPlayerMark(player, "@@joy__xinglunan")
  end,
})
joy__xinglunan:addEffect(fk.TurnStart, {
  refresh_events = {fk.TurnStart},
  can_refresh = function (self, event, target, player, data)
    return target == player and player:getMark("@@joy__xinglunan") > 0
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:setPlayerMark(player, "@@joy__xinglunan", 0)
  end,
})

joy__xinglunan:addEffect("distance", {
  name = "#joy__xinglunan_distance",
  correct_func = function(self, from, to)
    return to:getMark("@@joy__xinglunan")
  end,
})

return joy__xinglunan